import React, { useContext } from 'react'
import myContext from '../usecontext.js'
import { Table } from 'antd';




export default function Memory(props) {
  const seaver = useContext(myContext);

  const { jvm, sys } = seaver
  const columns = [
    {
      dataIndex: 'name',
      key: 'name',
    },
    {
      dataIndex: 'jvm',
      key: 'value',
    },
    {
      dataIndex: 'info',
      key: 'value',
    },
    {
      dataIndex: 'system',
      key: 'value',
    }
  ]
  const data = [
    {
      key: '1',
      name: 'java名称',
      jvm: jvm.name,
      info: 'java版本',
      system: jvm.version
    },
    {
      key: '2',
      name: '启动时间',
      jvm: jvm.startTime,
      info: '运行时长',
      system: jvm.runTime
    },
    {
      key: '3',
      name: '安装路径',
      jvm: jvm.home
    },
    {
      key: '4',
      name: '项目路径',
      jvm: sys.userDir
    }
  ]
  return (
    <Table bordered={true} showHeader={false} pagination={false} columns={columns} dataSource={data} />
  )
}
